package com.ss.android.article.base.feature.subscribe.b;

import com.ss.android.article.base.feature.app.b.DBHelper;
import com.ss.android.article.base.feature.subscribe.model.EntryItem;
import com.ss.android.common.AbsApiThread;
import com.ss.android.common.util.NetworkUtils;

final class h extends AbsApiThread {
    private final e c;
    private final long a;
    private final boolean b;

    h(e arg1, long arg2, boolean arg4) {
        this.c = arg1;
        this.a = arg2;
        this.b = arg4;

    }

    public final void run() {
        try {
            DBHelper v0_1 = DBHelper.getInstance(this.c.c);
            EntryItem v1 = v0_1.d(this.a);
            if(v1 != null) {
                v1.setSubscribed(this.b);
                v0_1.a(v1, v1.isSubscribed());
                this.c.a.obtainMessage(5, v1).sendToTarget();
                return;
            }

            if(!NetworkUtils.isNetworkAvailable(this.c.c)) {
                return;
            }

            v1 = android.support.design.a.d(this.a);
            if(v1 == null) {
                return;
            }

            v0_1.a(v1, v1.isSubscribed());
            this.c.a.obtainMessage(5, v1).sendToTarget();
        }
        catch(Exception v0) {
        }
    }
}

